<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>帖子</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <!-- <link rel="shortcut icon" href="/favicon.ico"> -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="../public/css/iconfont.css">
    <link rel="stylesheet" href="../public/css/homepage/addpost.css">
    <link rel="stylesheet" href="../public/css/homepage/comment.css">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/??sm.min.css,sm-extend.min.css">
    <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
    <style type="text/css">
        .infinite-scroll-preloader {
            margin-top: -20px;
        }

        .swiper-slide img {
            width: 100%;
        }
    </style>
</head>

<body>
    <div class="page">
        <header class="bar bar-nav">
            <a class="button button-link button-nav pull-left" href="/demos/card" data-transition='slide-out'>
                <span class="icon icon-left"></span>
                返回
            </a>
            <h1 class="title">发布你的帖子</h1>
        </header>
        <nav class="bar bar-tab">
            <!-- <input type="text" class="pinglun" placeholder="评论一下吧！"> -->
            <a href="javascript:;" class="goPinglun">发布帖子</a>
        </nav>

        <div class="content">
            <div class="list-block">
                <ul>
                  <!-- Text inputs -->
                  <li>
                    <div class="item-content">
                      <div class="item-media"><i class="icon icon-form-name"></i></div>
                      <div class="item-inner">
                        <div class="item-title label">标题</div>
                        <div class="item-input">
                          <input type="text" placeholder="Your name">
                        </div>
                      </div>
                    </div>
                  </li>
                </ul>
            </div>
            <div class="item-inner">
                <div class="item-input">
                    <textarea placeholder="在这里编辑你的帖子"></textarea>
                </div>
            </div>
            <div class="form-group addPerson">
                <div class="addPhoto">+</div>
                <div class="addinput"></div>
                <div class="addShow"></div>
            </div>
        </div>
    </div>

    <script src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script>
    <script>
        // 多图片上传
        var addBtn = $('.addPhoto');
        var allImg = $('.addShow');
        var allIpt = $('.addinput');
        var NUMBER = 0;
        //追加元素
        addBtn.click(function () {
            var addIpt = "<input type='file' name='postImg' class='file' />";
            allIpt.append(addIpt);
            $('[type=file]').eq(NUMBER).click();
            document.getElementsByClassName('file')[NUMBER].onchange = function () {
                var FILE = this.files[0];
                var reader = new FileReader();
                reader.onload = function (e) {
                    var IMG = "<div class=\"imgContainer\"><img src='" + e.target.result + "' /><i class=\"del iconfont icon-delete\"></i></div>";
                    allImg.append(IMG);
                    $("img").unbind();
                    $("img").click(function () {
                        var INDEX = $(this).index();
                        $("input").eq(INDEX)[0].remove();
                        $(this).remove();
                        NUMBER--;
                    });
                    $(".del").on("click", function () {
                        delInd = $(".del").index(this);
                        $(".imgContainer").eq(delInd).remove();
                    });
                };
                reader.readAsDataURL(FILE);
            };
            NUMBER++;
        });
    </script>

    <script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>


</body>

</html>